package com.neuedu.his.controller;

import com.neuedu.his.po.Constanttype;
import com.neuedu.his.po.User;
import com.neuedu.his.service.ConstanttypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/constanttype")
public class ConstantTypeController {

    @Autowired
    ConstanttypeService service;


    @RequestMapping("/add")
    public boolean add(@RequestBody  Constanttype type){
        boolean success= service.saveOrUpdate(type);
        return success;
    }


    @RequestMapping("/list")
    public List<Constanttype> list(){
        return service.list();
    }

    @RequestMapping("/getById/{id}")
    public Constanttype getById(@PathVariable String id){
        Constanttype constanttype  = service.getById(id);
        return constanttype;
    }
    @RequestMapping("/deleteById/{id}")
    public boolean deleteById(@PathVariable  String id){
        boolean success = service.removeById(id);
        return success;
    }
}
